import 'package:flutter/material.dart';
import 'package:flutter_component_pay/src/theme.dart';

/* 
 * 支付确认、取消按钮
 */
class AbsThirdPayButtonsView extends StatelessWidget {
  /// 点击左侧按钮事件
  final VoidCallback? onLeftEvent;

  /// 点击右侧按钮事件
  final VoidCallback? onRightEvent;

  const AbsThirdPayButtonsView({
    super.key,
    this.onLeftEvent,
    this.onRightEvent,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      height: AbsPayTheme.bottomWidgetHeight,
      alignment: Alignment.topCenter,
      padding: const EdgeInsets.only(left: 10, right: 10, top: 10),
      child: Row(
        children: [
          /// 左侧按钮
          Expanded(
            child: GestureDetector(
              onTap: () {
                onLeftEvent?.call();
                Navigator.of(context).pop();
              },
              child: Container(
                height: AbsPayTheme.bottomButtonHeight,
                alignment: Alignment.center,
                decoration: AbsPayTheme.bottomLeftDecoration,
                child: Text(
                  AbsPayTheme.bottomLeftTitle,
                  style: AbsPayTheme.bottomLeftTitleStyle,
                ),
              ),
            ),
          ),

          /// 水平间距
          const SizedBox(width: 10),

          /// 右侧按钮
          Expanded(
            child: GestureDetector(
              onTap: () {
                onRightEvent?.call();
                Navigator.of(context).pop();
              },
              child: Container(
                height: AbsPayTheme.bottomButtonHeight,
                alignment: Alignment.center,
                decoration: AbsPayTheme.bottomRightDecoration,
                child: Text(
                  AbsPayTheme.bottomRightTitle,
                  style: AbsPayTheme.bottomRightTitleStyle,
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
